<template>
  <view>
    <review-editor @submit="handleAddReview" />
  </view>
</template>

<script>
  export default {
    data() {
      return {
        bId: null
      };
    },
    methods: {
      async handleAddReview(reviewData) {
        // 调用API添加评论
        reviewData.bId = this.bId
        const {
          data: res
        } = await uni.$http.post("/review", reviewData)
        if (res.code !== 1) throw new Error('添加评论失败')
      }
    },
    onLoad(options) {
      this.bId = options.id
    }
  }
</script>

<style lang="scss">

</style>
